<?php
namespace app\apisell\controller\admin;

use app\BaseController;
use app\common\utils\Res;
use think\facade\Db;

class Aboutus extends BaseController
{
    //获取隐私协议
    public function getList()
    {
        $result = Db::table('xh_sell_aboutus')
            ->select();
        return Res::ok($result);
    }
    
    //添加协议
    public function created()
    {
        $param = $this->request->param();
        $result = Db::table('xh_sell_aboutus')->insert($param);
        return Res::ok($result);
    }
    
    //修改协议
    public function edited()
    {
        $param = $this->request->param();
        $data = [
            'type' => $param['type'],
            'content' => $param['content']
        ];
        $result = Db::table('xh_sell_aboutus')->where('id',$param['id'])->update($data);
        return Res::ok($result);
    }
    
    //获取详细信息
    public function getInfo()
    {
        $param = $this->request->param();
        $result = Db::table('xh_sell_aboutus')->where('id',$param['id'])->find();
        return Res::ok($result);
    }
}
